package com.gyf.mybatis2.dao;

import com.gyf.mybatis2.pojo.Order;
import com.gyf.mybatis2.pojo.User;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface IUserDao {

    List<User> findByCondition(User user);

    List<User> findByCondition1(User user);

    List<User> findByCondition2(int[] ids);

    List<Order> findOrderAndUser();

    List<User> findUserAndOrder();

    List<User> findUserAndRole();


    //使用注解开发

    @Insert("insert into user values(#{id},#{name})")
    void addUser(User user);

    @Update("update user set username = #{username} where id = #{id}")
    void updateUser(User user);

    @Select("select * from user")
    List<User> selectUser();

    @Delete("delete from user where id =#{id}")
    void deleteUser(Integer id);

    User findUserById(Integer id);

}
